import React from 'react';
import { connect } from 'react-redux';
import JokeActions from '@/pages/joke/actions';
import styles from './index.module.scss';

const GetJoke = (props: { getJoke: () => void }) => {
  const { getJoke } = props;

  // useEffect(() => {
  //   getJoke();
  // }, [props]);

  return (
    <button type="button" className={styles.btn} onClick={getJoke}>
      Press to see joke
    </button>
  );
};

const mapDispatchToProps = {
  getJoke: JokeActions,
};

export default connect(null, mapDispatchToProps)(GetJoke);
